package fr.charlott.tools.exceptions;

import java.util.List;

import org.apache.commons.lang.StringUtils;

public class FunctionalException extends Exception {

    private static final long serialVersionUID = -1006738185627191078L;

    private List<String> messages;

    private String property;

    /**
     * Empty constructor.
     */
    public FunctionalException() {
        super();
    }

    /**
     * Constructor.
     * 
     * @param message
     *            the message
     */
    public FunctionalException(String message) {
        this(message, "");
    }

    /**
     * Constructor.
     * 
     * @param message
     *            : the message
     * @param keyProperty
     *            : property key for i18n bundle
     */
    public FunctionalException(String message, String keyProperty) {
        super(message);
        if (StringUtils.isNotEmpty(keyProperty)) {
            this.setProperty(keyProperty);
        }
    }

    /**
     * Constructor.
     * 
     * @param message
     *            the message
     */
    public FunctionalException(List<String> messages) {
        this.messages = messages;
    }

    /**
     * Constructor.
     * 
     * @param throwable
     *            the throwable
     */
    public FunctionalException(Throwable throwable) {
        super(throwable);
    }

    /**
     * Constructor.
     * 
     * @param message
     *            the message
     * @param throwable
     *            the throwable
     */
    public FunctionalException(String message, Throwable throwable) {
        super(message, throwable);
    }

    public List<String> getMessages() {
        return messages;
    }

    /**
     * @return the property
     */
    public String getProperty() {
        return property;
    }

    /**
     * @param property
     *            the property to set
     */
    public void setProperty(String property) {
        this.property = property;
    }

}
